<template>
  <div>
    <i-cell-group>
      <i-cell
        v-for="(item,idx) in list"
        :key="idx"
        :title="item.name"
        is-link
        @click="linkClick(item)"
      ></i-cell>
    </i-cell-group>
  </div>
</template>

<script>
import {} from '@/utils'
import { FIND_SHOP_BASE_INFO } from '@/api'

export default {
  components: {},
  props: {},
  data () {
    return {
      shopIdentity: ''
    }
  },
  computed: {
    account () {
      return this.$store.state.account
    },
    list () {
      let arr = [
        {
          name: '店铺二维码',
          url: '/pages/mine/shop-config/qr-code-shop/main',
          isLink: this.shopIdentity === 'PERSONAL'
        },
        {
          name: '店铺小链接',
          url: '/pages/mine/shop-config/url/main',
          isLink: this.shopIdentity === 'PERSONAL'
        },
        {
          name: '公众号配置',
          url: '/pages/mine/shop-config/public-num/main',
          isLink: false
        },
        {
          name: '开通支付',
          url: '/pages/mine/shop-config/open-payment/main',
          isLink: false
        }
      ]
      return arr
    }
  },
  onShow () {
    this.getShopIdentityParams()
  },
  methods: {
    linkClick (item) {
      const vm = this
      if (!item.isLink) {
        vm.$router.push(`${item.url}`)
      } else {
        vm.$toast('请先开通实业宝')
      }
    },
    getShopIdentityParams () {
      const vm = this
      FIND_SHOP_BASE_INFO(vm.account.shopId).then(r => {
        if (r.data.code === '0') {
          vm.shopIdentity = r.data.data.shopIdentity
        } else {
          vm.$toast(r.data.message)
        }
      })
    }
  }
}
</script>
